// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import router from './router'
import Vue from 'vue'
import MintUI from 'mint-ui'
import Vuex from 'vuex'
import 'mint-ui/lib/style.css'
import api from './server/apiMethods'
import Cropper from 'cropperjs'
import { ChartPie } from 'vue-d2b'
import { Carousel3d, Slide } from 'vue-carousel-3d';
import App from './App.vue'
import { Input,Dropdown,Button,InputNumber,radio,select,Switch,Upload,Checkbox,CheckboxButton,CheckboxGroup,Step,Steps,} from 'element-ui';
import rate from 'vue-rate';

Vue.use(rate)
Vue.use(MintUI)
Vue.use(Input);
Vue.use(Button);
Vue.use(InputNumber);
Vue.use(radio);
Vue.use(select);
Vue.use(Switch);
Vue.use(Dropdown);
Vue.use(Checkbox);
Vue.use(Upload);
Vue.use(CheckboxButton);
Vue.use(CheckboxGroup);
Vue.use(Steps);
Vue.use(Step);
Vue.config.productionTip = false
Vue.prototype.$api = api
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: {App},
  template: '<App/>'
})
router.beforeEach((to, from, next) => {
    if(to.meta.auth) { //是否验证
        const data = JSON.parse(localStorage.getItem('confirm'));
        if(data.identification==1) { //是否实名认证
            next()
        } else { //未认证调到认证页面
            next({
                name: 'noCertified',
                query: {
                    redirect: to.fullPath
                }
            })
        }
    } else {
        next()
    }
})
